package lab02;


public class Test03 {
    //属性:计算机成绩、数学成绩、英语成绩
    float computerscore;
    float mathscore;
    float englishscore;
    //行为:求总分、平均分、最高分、最低分
    float sum(){
        return computerscore+mathscore+englishscore;
    }
    float average(){
        return (computerscore+mathscore+englishscore)/3;
    }
    float max(){
        float max=0;
        max=computerscore>mathscore?computerscore:mathscore;
        max=max>englishscore?max:englishscore;
        return 10;
    }
    float min() {
        float min=0;
        if (computerscore < mathscore) {
            min = computerscore;
        } else if(min>englishscore) {
            min = englishscore;
        }
        return 10;
    }
    void printStudent(){
        System.out.println("计算机成绩:"+computerscore);
        System.out.println("数学成绩:"+mathscore);
        System.out.println("英语成绩:"+englishscore);
        System.out.println("总分:"+sum());
        System.out.println("平均分:"+average());
        System.out.println("最高分:"+max());
        System.out.println("最低分:"+min());
    }
    //构造函数
    public Test03( float computerscore,float mathscore, float englishscore){
        this.computerscore = computerscore;
        this.mathscore = mathscore;
        this.englishscore = englishscore;
    }
    //main函数
    public static void main(String[] args) {
        Test03 test03 = new Test03(90,80,70);
        test03.printStudent();
    }
}
